home *** CD-ROM | disk | FTP | other *** search
- /* GadTools layout toolkit
- **
- ** Copyright © 1993-1995 by Olaf `Olsen' Barthel
- ** Freely distributable.
- */
-
- #include "gtlayout_global.h"
-
- VOID __regargs
- LTP_DisposeGadgets(struct LayoutHandle *Handle)
- {
- if(Handle -> List)
- {
- struct Gadget *Gadget;
- ObjectNode *Node;
-
- if(Handle -> Window)
- RemoveGList(Handle -> Window,Handle -> List,(UWORD)-1);
-
- Gadget = Handle -> List;
-
- if(Handle -> ExitFlush)
- {
- while(Gadget)
- {
- if(GETOBJECT(Gadget,Node))
- {
- LTP_PutStorage(Node);
-
- LTP_DeleteObjectNode(Handle,Node);
- }
-
- Gadget = Gadget -> NextGadget;
- }
- }
- else
- {
- while(Gadget)
- {
- if(GETOBJECT(Gadget,Node))
- LTP_DeleteObjectNode(Handle,Node);
-
- Gadget = Gadget -> NextGadget;
- }
- }
-
- FreeGadgets(Handle -> List);
-
- Handle -> List = NULL;
- }
-
- #ifdef DO_BOOPSI_KIND
- if(Handle -> BOOPSIList)
- {
- struct Gadget *gadget = (struct Gadget *)Handle -> BOOPSIList,*next;
- ObjectNode *Node;
-
- if(Handle -> Window)
- RemoveGList(Handle -> Window,(struct Gadget *)Handle -> BOOPSIList,(UWORD)-1);
-
- while(gadget)
- {
- next = gadget -> NextGadget;
-
- if(GETOBJECT(gadget,Node))
- {
- DisposeObject(gadget);
-
- if(Node -> Type == BOOPSI_KIND)
- {
- if(Node -> Special . BOOPSI . ClassBase)
- {
- CloseLibrary(Node -> Special . BOOPSI . ClassBase);
-
- Node -> Special . BOOPSI . ClassBase = NULL;
- }
-
- if(Node -> Special . BOOPSI . ClassTags)
- {
- FreeTagItems(Node -> Special . BOOPSI . ClassTags);
-
- Node -> Special . BOOPSI . ClassTags = NULL;
- }
- }
-
- Node -> Host = NULL;
- }
-
- gadget = next;
- }
-
- Handle -> BOOPSIList = NULL;
- Handle -> BOOPSIPrevious = NULL;
- }
- #endif /* DO_BOOPSI_KIND */
- }
-
-
- /*****************************************************************************/
-
-
- VOID LIBENT
- LT_DeleteHandle(REG(a0) LayoutHandle *Handle)
- {
- if(Handle)
- {
- UnlockPubScreen(NULL,Handle -> PubScreen);
- #ifdef DO_CLONING
- if(Handle -> CloneExtra)
- {
- if(Handle -> CloneExtra -> Screen)
- ScreenToBack(Handle -> CloneExtra -> Screen);
- }
- #endif
- LTP_DisposeGadgets(Handle);
-
- LT_UnlockWindow(Handle -> Parent);
-
- if(Handle -> Window)
- {
- LT_DeleteWindowLock(Handle -> Window);
-
- if(Handle -> MsgPort && Handle -> Window -> UserPort)
- {
- struct IntuiMessage *intuiMsg;
- struct Node *next;
-
- Forbid();
-
- intuiMsg = (struct IntuiMessage *)Handle -> Window -> UserPort -> mp_MsgList . lh_Head;
-
- while(next = intuiMsg -> ExecMessage . mn_Node . ln_Succ)
- {
- if(intuiMsg -> IDCMPWindow == Handle -> Window)
- {
- Remove(intuiMsg);
-
- ReplyMsg(intuiMsg);
- }
-
- intuiMsg = (struct IntuiMessage *)next;
- }
-
- Handle -> Window -> UserPort = NULL;
-
- ModifyIDCMP(Handle -> Window,NULL);
-
- Permit();
- }
-
- ClearMenuStrip(Handle -> Window);
- CloseWindow(Handle -> Window);
- }
-
- #ifdef DO_MENUS
- LT_DisposeMenu(Handle -> Menu);
- #endif // DO_MENUS
-
- DisposeObject(Handle -> AmigaGlyph);
- DisposeObject(Handle -> CheckGlyph);
-
- FreeScreenDrawInfo(Handle -> Screen,Handle -> DrawInfo);
-
- FreeVisualInfo(Handle -> VisualInfo);
-
- if(Handle -> RPort . Font && Handle -> CloseFont)
- CloseFont(Handle -> RPort . Font);
- #ifdef DO_CLONING
- if(Handle -> CloneExtra)
- {
- if(Handle -> CloneExtra -> Screen)
- CloseScreen(Handle -> CloneExtra -> Screen);
- }
- #endif
-
- AsmDeletePool(Handle -> Pool,SysBase);
- }
- }
-